<button id="addPage">添加 测试 tab </button>


<script>
    layui.use(['jquery', 'laytpl', 'tabPage'], () => {
        let $ = layui.jquery,
            tabPage = layui.tabPage
        ;
        $('#addPage').on('click', () => {
            let id = 'pages/demo/baidu.html?' + Math.random();
            tabPage.tabAdd({
                href: id,
                title: id,
                allowClose: true
            });
        });
    });
</script>